#include "Mouse.h"

bool CMouse::ButtonDown(int button)
{
  return m_state.buttons[button];
}

bool CMouse::ButtonUp(int button)
{
  return !(m_state.buttons[button]);
}	

void  CMouse::GetMovement(int &dx, int &dy)
{
  dx = m_state.x;
  dy = m_state.y;
}

bool CMouse::Update()
{
  Uint8 button_mask;
  button_mask = SDL_GetRelativeMouseState(&m_state.x, &m_state.y);
  for(int i=1;i<=N_MOUSE_BUTTONS;i++)
	m_state.buttons[i] = button_mask & SDL_BUTTON(i);

  return true;
}

